import unittest

import requests

import re


base_url = r'http://172.16.22.104:8080'
home_url = base_url + r'/bsams/front/login.do'
vericode_url = base_url + r'/bsams/front/vericode.do'
# 构造请求头
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
id=1
username='weixun'
password='123456'
vericode='shtd'
data = {
        'taskId': id,
        'loginName': username,
        'password': password,
        'vericode': vericode
    }

resp = requests.get(home_url)
cookies = resp.cookies.get_dict()
resp= requests.get(vericode_url)
resp_login = requests.post(home_url, data=data)
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp_login.text)

statuscode = resp_login.status_code
result_list = [title, cookies, statuscode]

print(result_list)